package ch.dungegondefenders.playfield;

public class ExamplePlayField implements PlayField {

	private int width = 10;
	private int height = 15;

	private final Field[][] fields;
	private Field field;

	public ExamplePlayField() {

		fields = new Field[width][height];
		initFields();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ch.dungegondefenders.playfield.PLAYfIELD#getWidth()
	 */
	@Override
	public int getWidth() {
		return width;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ch.dungegondefenders.playfield.PLAYfIELD#getHeight()
	 */
	@Override
	public int getHeight() {
		return height;
	}

	private void initFields() {

		int x = 0;
		int y = 0;

		for (x = 0; x < width; x++) {
			for (y = 0; y < height; y++) {
				if (x != 3) {

					fields[x][y] = new FieldFactory()
							.setHeight(35)
							.setWidth(35)
							.setDisplayType(FieldDisplayTypes.GREEN)
							.setBehaviourType(
									FieldBehaviourTypes.ACCESSIBLE_PLAYER_GROUND)
							.build();

				} else {
					fields[x][y] = new FieldFactory()
							.setHeight(35)
							.setWidth(35)
							.setDisplayType(FieldDisplayTypes.BROWN)
							.setBehaviourType(
									FieldBehaviourTypes.ACCESSIBLE_ENEMY_GROUND)
							.build();
				}
			}
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ch.dungegondefenders.playfield.PLAYfIELD#getFields()
	 */
	@Override
	public Field[][] getFields() {
		return fields;
	}

}
